<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
         1.属性值简写  
     */
    let name = '张三'
    let obj = {name}

    /*
        2.可计算属性
     */
    let nameKey = 'name'
    let person = {}
    person[nameKey] = 'jack'

    /*
        3.简写方法名
     */

    // 普通的
    let person = {
        sayName: function (name) {
            console.log(name)
        }
    }
    // 现在
    let person = {
        _name: '',
        sayName(name) {
            console.log(name)
        },
        //同样也可以用在get和set上
        get name() {
            return this._name;
        },
        set name(newName) {
            this._name = name
        }
    }

    /*
        4.简写方法和可计算属性结合
     */

    const filedMethodName = 'sayName'
    let person2 = {
        [filedMethodName](name) {
            
        }
    }

</script>
</body>
</html>